

function pagePath(ppth, tabPageFlag){
	if(!ppth.startsWith("/")){
		ppth = "/"+ppth;
	}
	
	return {
		"path":ppth,
		"tabPageFlag":!!tabPageFlag
	}
}

export function navigateTo(page){
	if(typeof(page)=="string"){
		page = appPageInfoExp[page]
	}
	if(page.tabPageFlag){
		uni.switchTab({
		  url: page.path
		})
	}else{
		uni.navigateTo({
			url: page.path
		})
				  
	}
};


export function redirectTo(page){
	if(typeof(page)=="string"){
		page = appPageInfoExp[page]
	}
	console.log("redirectTo", page);
	if(page.tabPageFlag){
		uni.switchTab({
		  url: page.path
		})
	}else{
		uni.redirectTo({
			  url: page.path
		})
	}
};




export const lifeRestart = pagePath("/pages/lifeRestart/lifeRestart",false); 

// 底部栏

const appPageInfoExp = {
	lifeRestart,
	navigateTo,
	redirectTo
	
};
export default appPageInfoExp

